#!/bin/bash
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
# 检查输入参数数量
if [ "$#" -ne 5 ]; then
    echo "Usage: $0 <input_file> <output_file> <dx> <dy> <dz>"
    exit 1
fi

input_file=$1
output_file=$2
dx=$3
dy=$4
dz=$5

# 使用Snap安装的CloudCompare命令
/snap/bin/cloudcompare.CloudCompare  -O "$input_file" -APPLY_TRANS "$dx $dy $dz" -SAVE_CLOUDS FILE="$output_file" -LOG FILE="cloudcompare_log.txt"

# 检查命令是否成功执行
if [ $? -ne 0 ]; then
    echo "Error occurred while translating point cloud"
    exit 1
fi

echo "Point cloud translated successfully."
